//
//  ProductDataSource.m
//  freeLance
//
//  Created by Igor Karpenko on 3/30/13.
//  Copyright (c) 2013 Mozi Development. All rights reserved.
//
#import "CDImages.h"
#import "ProductViewCell.h"
#import "KTPhotoView.h"

#import "ProductDataSource.h"

@implementation ProductDataSource


#pragma mark - Instance initialization

-(id) initWithProduct:(CDProducts *)product {
	self = [super init];
	if (!self) {
		return nil;
	}
	_product = product;
	_items = [_product.images allObjects];

	return self;
}


#pragma mark - Delegated methods

-(NSInteger)numberOfPhotos {
	return _items.count;
}


-(void) imageAtIndex:(NSInteger)index photoView:(KTPhotoView *)photoView {
	CDImages *image = _items[index];
	[photoView setImage:[UIImage imageWithContentsOfFile:image.imagePath]];
}


-(UIColor *) imageBackgroundColor {
	return [UIColor whiteColor];
}

@end
